﻿-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<添加新的提醒>
-- =============================================
CREATE PROCEDURE [dbo].[proc_TimeRemind_Create]
(
	@UserName NVARCHAR(50),
	@RemindTitle NVARCHAR(50),
	@RemindText NVARCHAR(1000),
	@TimeType INT,
	@RemindTime VARCHAR(50),
	@RemindWeekday VARCHAR(50),
	@RemindDay VARCHAR(50),
	@RemindMonth VARCHAR(200),
	@RemindYear VARCHAR(50)
)
AS
DECLARE @Count INT
BEGIN
	 SELECT @Count=COUNT(*) FROM TimeRemind WHERE UserName=@UserName
	
	IF @Count < 30 --提醒数量限制
	BEGIN

	INSERT INTO [TimeRemind]
           ([UserName]
           ,[RemindTitle]
           ,[RemindText]
           ,[TimeType]
           ,[RemindTime]
           ,[RemindDay]
           ,[RemindWeekday]
           ,[RemindMonth]
           ,[RemindYear]
           ,[CreateDate])
     VALUES
           (
           	@UserName
           ,@RemindTitle
           ,@RemindText
           ,@TimeType
           ,@RemindTime
           ,@RemindDay
           ,@RemindWeekday
           ,@RemindMonth
           ,@RemindYear
           ,GETDATE()
           )
	END
	ELSE
		BEGIN
			SELECT -1
		END
	SET NOCOUNT ON;
END